package com.wb3.meta.api.core.controller;

import com.wb3.meta.api.core.service.PrizeInfoService;
import com.wb3.meta.api.core.vo.ReqPrizeInfoVo;
import com.wb3.meta.common.annotation.NoPermission;
import com.wb3.meta.common.plugin.BaseResultController;
import com.wb3.meta.common.pojo.ResultT;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "奖品接口")
@RequestMapping("base/prize/info/")
public class PrizeInfoController extends BaseResultController<ReqPrizeInfoVo> {

    @Autowired
    private PrizeInfoService prizeInfoService;
    /**
     * 列表接口
     *
     * @param reqPrizeInfoVo
     */
    @Override
    @ApiOperation("列表接口")
    @GetMapping("list")
    public ResultT list(ReqPrizeInfoVo reqPrizeInfoVo) {

        return prizeInfoService.getModelMapPage(reqPrizeInfoVo);
    }


    /**
     * 明细接口
     *
     * @param reqPrizeInfoVo
     */
    @Override
    @ApiOperation("详情接口")
    @GetMapping("detail")
    public ResultT detail(ReqPrizeInfoVo reqPrizeInfoVo) {
        return prizeInfoService.getModelMapById(reqPrizeInfoVo.getId());
    }

    /**
     * 新增or更新接口
     *
     * @param reqPrizeInfoVo
     */
    @NoPermission
    @Override
    @ApiOperation("更新接口")
    @PostMapping("update")
    public ResultT saveOrUpdate(@RequestBody ReqPrizeInfoVo reqPrizeInfoVo) {
        return prizeInfoService.saveOrUpdate(reqPrizeInfoVo);
    }

    /**
     * 删除接口
     *
     * @param reqPrizeInfoVo
     */
    @NoPermission
    @Override
    @ApiOperation("删除接口")
    @PostMapping("delete")
    public ResultT delete(@RequestBody ReqPrizeInfoVo reqPrizeInfoVo) {
        return prizeInfoService.delete(reqPrizeInfoVo);
    }
}
